﻿// -----------------------------------------------------------------------
// <copyright file="Events.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Core.Player
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Events
    {
        /// <summary> Lock synchronization object. </summary>
        private static readonly object Padlock = new object();

        /// <summary> Stores the current instance of this class </summary>
        private static Events instance = null;

        /// <summary> Open file event </summary>
        private EventHandler open;

        /// <summary> Open file event </summary>
        private EventHandler beforeOpen;

        /// <summary> Play file event </summary>
        private EventHandler play;

        /// <summary> Pause playback event </summary>
        private EventHandler pause;

        /// <summary> Stop playback event </summary>
        private EventHandler stop;

        /// <summary> Resume playback event </summary>
        private EventHandler resume;

        /// <summary> Seek media event </summary>
        private EventHandler seeking;

        /// <summary> Volume changed event </summary>
        private EventHandler volumeChanged;

        /// <summary> Dispose objects event </summary>
        private EventHandler dispose;

        /// <summary> Occurs when the playback is stopped </summary>
        private EventHandler playbackEnded;

        /// <summary> Occurs when the radio song is changed </summary>
        private EventHandler radioSongChanged;

        /// <summary> Prevents a default instance of the Events class from being created. </summary>
        private Events()
        {
        }

        /// <summary> Gets the current instance of this class (Singleton - Thread safety) </summary>
        public static Events Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (Padlock)
                    {
                        if (instance == null)
                        {
                            instance = new Events();
                        }
                    }
                }

                return instance;
            }
        }

        /// <summary>
        /// Gets or sets the open event
        /// </summary>
        public EventHandler Open
        {
            get
            {
                return this.open;
            }

            set
            {
                this.open = value;
            }
        }

        /// <summary>
        /// Gets or sets the open event
        /// </summary>
        public EventHandler BeforeOpen
        {
            get
            {
                return this.beforeOpen;
            }

            set
            {
                this.beforeOpen = value;
            }
        }

        /// <summary>
        /// Gets or sets the play event
        /// </summary>
        public EventHandler Play
        {
            get
            {
                return this.play;
            }

            set
            {
                this.play = value;
            }
        }

        /// <summary>
        /// Gets or sets the pause event
        /// </summary>
        public EventHandler Pause
        {
            get
            {
                return this.pause;
            }

            set
            {
                this.pause = value;
            }
        }

        /// <summary>
        /// Gets or sets the stop event
        /// </summary>
        public EventHandler Stop
        {
            get
            {
                return this.stop;
            }

            set
            {
                this.stop = value;
            }
        }

        /// <summary>
        /// Gets or sets the resume event
        /// </summary>
        public EventHandler Resume
        {
            get
            {
                return this.resume;
            }

            set
            {
                this.resume = value;
            }
        }

        /// <summary>
        /// Gets or sets the seeking event
        /// </summary>
        public EventHandler Seeking
        {
            get
            {
                return this.seeking;
            }

            set
            {
                this.seeking = value;
            }
        }

        /// <summary>
        /// Gets or sets the volume changed event
        /// </summary>
        public EventHandler VolumeChanged
        {
            get
            {
                return this.volumeChanged;
            }

            set
            {
                this.volumeChanged = value;
            }
        }

        /// <summary>
        /// Gets or sets the dispose event
        /// </summary>
        public EventHandler Dispose
        {
            get
            {
                return this.dispose;
            }

            set
            {
                this.dispose = value;
            }
        }

        /// <summary>
        /// Gets or sets the playback end event
        /// </summary>
        public EventHandler PlaybackEnded
        {
            get
            {
                return this.playbackEnded;
            }

            set
            {
                this.playbackEnded = value;
            }
        }

        /// <summary>
        /// Gets or sets the radio song change event
        /// </summary>
        public EventHandler RadioSongChanged
        {
            get
            {
                return this.radioSongChanged;
            }

            set
            {
                this.radioSongChanged = value;
            }
        }
    }
}
